////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   CodeDetailsQuery.java
// AUTHOR           :   ric.yik
// DATE CREATE      :   Feb 7, 2006
// DESCRIPTION      :   
//                  :   
//                  :   
//                  :   
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// Feb 7, 2006      ric.yik         1.0                 source is created.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.common.query;

import com.erp.app.setup.codeSetup.pk.CodeDtlPk;
import com.erp.app.setup.codeSetup.pk.CodeHdrPk;


public class CodeDetailsQuery extends BeanQuery {

    private String companyCode;

    private String referenceMasterCode;

    private String referenceCode;

    private String order;

    public CodeDetailsQuery() {
        super("SELECT REF_CODE, REF_DESC FROM T_CODE_DTL WHERE " +
                "REF_MASTER_CODE = `referenceMasterCode:string` AND " +
                "COMPANY_CODE = `companyCode:string` AND " +
                "(REF_STATUS = `$GENERIC_ACTIVE:string` OR REF_CODE = `referenceCode:string`) ORDER BY `order`");
        this.setModel(this);
        this.setOrder("SEQ, REF_CODE, REF_DESC");
    }

    public String getCompanyCode() {
        return companyCode;
    }

    public CodeDetailsQuery setCompanyCode(String companyCode) {
        this.companyCode = companyCode;
        return this;
    }

    public String getReferenceMasterCode() {
        return referenceMasterCode;
    }

    public CodeDetailsQuery setReferenceMasterCode(String referenceMasterCode) {
        this.referenceMasterCode = referenceMasterCode;
        return this;
    }

    public String getOrder() {
        return order;
    }

    public CodeDetailsQuery setOrder(String order) {
        this.order = order;
        return this;
    }

    public String getReferenceCode() {
        return referenceCode;
    }

    public CodeDetailsQuery setReferenceCode(String referenceCode) {
        this.referenceCode = referenceCode;
        return this;
    }

    public CodeDetailsQuery setCodeHdrPk(CodeHdrPk pk) {
        this.setCompanyCode(pk.getCompanyCode());
        this.setReferenceMasterCode(pk.getRefMasterCode());
        return this;
    }

    public CodeDetailsQuery setCodeDtlPk(CodeDtlPk pk) {
        this.setCompanyCode(pk.getCompanyCode());
        this.setReferenceMasterCode(pk.getRefMasterCode());
        this.setReferenceCode(pk.getRefCode());
        return this;
    }

}
